package com.yuchen.ishop.service.login;

import com.yuchen.jaxrs.restclient.RestClientUtils;
import com.yuchen.ishop.vo.LoginParam;
import com.yuchen.utils.config.ConfigUtils;
import com.yuchen.jaxrs.Responses;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;


/**
 * @author Jack Q
 */
@Service
public class LoginRestClient {

    private final static Logger LOG = Logger.getLogger(LoginRestClient.class);

    public  Responses sellerLogin(String account,String password){
        LoginParam loginParam = new LoginParam();
        loginParam.setAccount(account);
        loginParam.setPassword(password);
        String url = ConfigUtils.config.get("login_seller");
        Responses json =  RestClientUtils.post(Responses.class,loginParam, url);
       // LOG.info(json);
        return json;
    }
    
    public  Responses buyerLogin(String account,String password){
        LoginParam loginParam = new LoginParam();
        loginParam.setAccount(account);
        loginParam.setPassword(password);
        String url = ConfigUtils.config.get("login_buyer");
        Responses json =  RestClientUtils.post(Responses.class,loginParam, url);
       // LOG.info(json);
        return json;
    }

    public Responses xiaoerLogin(String account, String password) {
        LoginParam loginParam = new LoginParam();
        loginParam.setAccount(account);
        loginParam.setPassword(password);
        String url = ConfigUtils.config.get("login_xiaoer");
        Responses json =  RestClientUtils.post(Responses.class,loginParam, url);
       // LOG.info(json);
        return json;
    }
}
